package com.zz.bid.config;

import com.zz.bid.web.filter.CorsFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SuppressWarnings("ALL")
@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private CorsFilter corsFilter;

    @SuppressWarnings("unchecked")
    @Bean
    public FilterRegistrationBean testFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean(corsFilter);
        registration.addUrlPatterns("/*");
        registration.setName("corsFilter");
        return registration;
    }
}

